<template>
	<view class="content">
		<template v-if="list.length>0">
			<view class="info-list" v-for="item in list" :key="item.id"
				@click="navigate('/page_other/special_recruitment/recruit?id='+item.id)">
				<view class="info-item">
					<image :src="item.image" class="special-img"></image>
					<view class="title FangZhengHanZhenGuangBiaoJianTi">{{item.title}}</view>
				</view>
				<view class="name">{{item.title}}</view>
				<view class="time">{{item.createTime}}</view>
			</view>
		</template>
		<view v-if="more==false&&list.length==0" class="empty">暂无数据</view>
		<view v-else-if="more==false&&list.length>0" class="empty">没有更多了</view>
	</view>
</template>

<script>
	import {
		isMore
	} from '@/util/util.js'
	import {
		getSpecialRecruitmentList
	} from '@/api/job_hunting.js';
	export default {
		data() {
			return {
				list: [],
				conf: {
					page: 1,
					limit: 10
				},
				more: true,
			}
		},
		methods: {
			refresh() {
				this.conf.page = 1
				this.more = true
				this.getList(true);
			},
			getList(refresh = false) {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getSpecialRecruitmentList({
					page: this.conf.page,
					limit: this.conf.limit
				}).then((res) => {
					let list = res.list || [];
					if (refresh) {
						this.list = list;
					} else {
						this.list = [...this.list, ...list]
					}
					this.more = isMore(this.conf.page, this.conf.limit, res.count)
				})
			}
		},
		onReachBottom() {
			if (this.more) {
				this.conf.page++;
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				this.getList();
			}
		},
		onLoad(e) {
			this.getList(true)
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-image: $custom-background-gradient;
	}

	.content {
		padding: 30rpx;

		.info-list {
			padding: 30rpx;
			background: #FFFFFF;
			margin-bottom: 20rpx;
			border-radius: 30rpx;

			.info-item {
				width: 100%;
				height: 300rpx;
				text-align: center;

				.special-img {
					width: 100%;
					height: 300rpx;
					border-radius: 30rpx 30rpx 0 0;
				}

				.title {
					margin-top: -180rpx;
					z-index: 2;
					font-size: 55rpx;
					color: #FFFFFF;
				}
			}

			.name {
				font-size: 32rpx;
				margin-top: 20rpx;
			}

			.time {
				font-size: 28rpx;
				margin-top: 20rpx;
				color: #767676;
			}
		}
	}
</style>